public class Overloading
{
    public static void main(String args[])
    {
        printHello();
        System.out.println("----------");
        printHello(2);
        System.out.println("----------");
        printHello("three");
    } 
    
    public static void printHello()
    {
        System.out.println("Hello Java");        
    }
    
    public static void printHello(int n)
    {
        if(n>3)
        {
           System.out.println("sorry,more than 3!");
           return;
        }
        else if(n<0)
        {
           System.out.println("sorry,bad command!");
           return;
        }
        for(int i=0;i<n;i++)
           printHello();
    }
    public static void printHello(String str1)
    {
        if(str1=="one") printHello();
        else if(str1=="two") printHello(2);
        else if(str1=="three") printHello(3);
        else System.out.println("sorry,more than 3 or bad command!");
    }    
}
